<template>
  <van-sticky>
    <div class="navbar">
      <van-icon class="navcross" name="arrow-left" @click="goBack" />
      <span class="nav-title">商品详情</span>
    </div>
  </van-sticky>
</template>

<script>
export default {
  name: 'Navbar',
  methods: {
    async goBack() {
      await this.$router.go(-1)
    }
  }
}
</script>

<style scoped>
.navbar {
  position: relative;
  width: 100%;
  background-color: #fff;
  border-bottom: 1px solid #ccc;
  height: .45rem;
  line-height: .45rem;
}
.navcross {
  position: absolute;
  padding-left: .2rem;
  margin-top: .13rem;
  color: darkred;
  font-size: .2rem;
}
.nav-title {
  display: block;
  font-size: .18rem;
  text-align: center;
}
</style>